<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#timer{
				width: 300px;
				height: 100px;
				border: 1px dotted #AAAAAA;
				line-height: 100px;
				text-align: center;
				margin: 100px auto;
			}
			em{
				font-style: normal;
				color: red;
				font-size: 18px;
				font-weight: 700;
			}
		</style>
	</head>
	<body>
		<div id="timer">
			页面将在<em></em>s后跳转
		</div>
		<script type="text/javascript">
			var aEm = document.getElementsByTagName('em')[0];
			var num = 5
			setInterval(function(){
				num--
				aEm.innerHTML= num;
				if (num<=0) {
					location.href = 'https://www.baidu.com/';
				}
			},1000)
		</script>
	</body>
</html>
